<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>门票产品配置</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>
<style>
    #nearbyPoiMap{
        height:400px;
    }
    ul,li{ padding:0;margin:0;list-style:none}
    .disabled { pointer-events: none; }
    .addclassify {
        display: inline-block;
        width: 80px;
        height: 30px;
        border: 1px solid #ccc;
        line-height: 30px;
        /*border-radius: 40px;*/
        text-align: center;
        cursor: pointer;
        background: #1E9FFF;
        color: #fff;
    }
    .addnumsty {
        /*background: #00a0e9;*/
        position: absolute;
        left: -11px;
        top: 10px;
        background: #1E9FFF;
        color: #fff;
        display: inline-block;
        width: 32px;
        height: 32px;
        border: 1px solid #1E9FFF;
        line-height: 32px;
        border-radius: 32px;
        text-align: center;
        cursor: pointer;
    }
    .layui-form-select .layui-edge {
        display: none;
    }
    .travelulone{
        display: flex;
        margin-bottom: 20px;
    }
    .addli{
        position: relative;
    }
    .deleteDay{
        position: absolute;
        right: 40px;
        top: 0;
    }
    .deleteDay i{
        color: red;
        font-size: 18px;
    }
    .ActionButton{
        z-index: 2;
        position: fixed;
        right: 20px;
        bottom: 140px;
        min-width: 125px;
    }
    .Actiondiv{
        /*display: inline-block;*/
        height: 38px;
        line-height: 38px;
        padding: 0 18px;
        background-color: #1E9FFF;
        color: #fff;
        white-space: nowrap;
        text-align: center;
        font-size: 14px;
        border: none;
        border-radius: 2px;
        cursor: pointer;
        -webkit-box-shadow: 0 2px 8px rgba(0,0,0,.15);
        box-shadow: 0 2px 8px rgba(0,0,0,.15);
        /*margin-bottom: 5px;*/
    }
    .layui-card-header{
        color: #ff7d00;
        font-weight: bold;
        font-size: 20px;
    }
    .layui-card-body{
        padding: 10px 50px;
    }
    .custom_input{
        width: 150px;
        border: 1px solid #cccccc;
        margin-left: 5px;
        margin-right: 50px;
        height: 30px;
        border-radius: 5px;
    }
    .material_data{
        /*border: 1px solid #CCCCCC;*/
        /*margin: 20px;*/
    }
    .unifybut{
        border: 1px solid #2196f3;
        text-align: center;
        margin-left: 40px;
        margin-bottom: 20px;
        width: 50px;
        height: 30px;
        line-height: 30px;
        border-radius: 5px;
        color: #fff;
        background:#2196f3;
    }
    .unifydelbut{
        border: 1px solid red;
        text-align: center;
        margin-left: 40px;
        margin-bottom: 20px;
        width: 50px;
        height: 30px;
        line-height: 30px;
        border-radius: 5px;
        color: #fff;
        background: red;
    }
    .unifybutadd{
        /*border: 1px solid #2196f3;*/
        text-align: center;
        /*margin-left: 12px;*/
        /*margin-bottom: 20px;*/
        width: 30px;
        height: 30px;
        line-height: 30px;
        /*border-radius: 2px;*/
        color: #fff;
        background: #ccc;
    }
    .layui-card-body span{
        font-size: 12px;
        line-height: 30px;
    }
    .layui-input{
        border-radius: 5px;
        height: 30px;
    }
    .layui-select-title{
        height: 30px;
    }
    .layui-form-label{
        line-height: 12px;
    }
    .deletePoi{
        margin-left: 80px;
        display: none;
    }
    .messdiv{
        height: 40px;
    }
    .messdiv:hover .deletePoi{display: block;}
    /*.messdiv:hover .detail-create-list*/
    /*{display: block;}*/
    .custom_input_s {
        width: 150px;
        margin-top: 0px;
        margin-right: 52px;
        margin-left: 13px;
        height: 30px;
        border-radius: 5px;
    }
    .layui-select-title input{
        border: 1px solid #ccc;
    }
    .partitionBox{
        display: flex;
    }
    /*右侧css*/
    .poi-detail{
        /*display: flex;*/
    }
    .poi-detail-item{
        font-size: 12px;
        padding: 8px;
        display: inline-block;
        vertical-align: top;
        border: 1px solid #dfdfdf;
        width: 30%;
    }
    .poi-detail-item-imgbox{
        max-width: 200px;
        position: relative;
        margin: 0 auto;
    }
    .poi-detail-item-imgbox img{
        width: 100%;
        height: 100px;
    }
    .poi-detail-item p{
        text-align: center;
        /*max-width: 200px;*/
        line-height: 18px;
        font-size: 12px;
    }
    .poi-detail-item p:nth-child(3)
    {
        font-size: 14px;
    }
    .poi_img_shadow {
        border: 3px solid #a7ff19;
        top: 0px;
        position: absolute;
        /* left: 167px; */
        width: 75px;
        display: none;

    }
    .poicheckeds{
        display:none;
    }
    .schedule_title{
        width: 100%;
    }
    .messdiv .layui-form-label{
        width: 20px;
    }
    .poi-p-list-box{
        height: 30px;
        padding: 0 5px;
        color: #999;
    }
    .poi-detail{
        /*padding:0 20px;*/
    }
    .btnfix{
        z-index: 999;
        position: fixed;
        right: 0px;
        bottom: 80px;
        min-width: 75px;
    }
    .btnfix img{
        width: 50px;
        height: 50px;
    }
    .poibtnshow{
        display: block;
        z-index:999;
    }
    .dragUp,.dragDown{
        height: 30px;
        line-height: 30px;
        background: #009688;
        text-align: center;
        color: #fff;
        margin-bottom: 3px;
        box-shadow: 0px 7px 7px -7px #5E5E5E;
    }
    .dragUpPricing,.dragDownPricing{
        height: 30px;
        line-height: 30px;
        /*background: #ff7d00;*/
        text-align: center;
        /*color: #fff;*/
        margin-bottom: 3px;
        box-shadow: 0px 7px 7px -7px #5E5E5E;
    }
    .rightPoiInfo_item{
        width: 100%;
        line-height: 30px;
        font-size: 13px;
        margin-bottom: 8px;
    }
    .rightPoiInfo_item label{
        float:left;
        font-weight: bold;
        width: 80px;
        text-align: right;
    }
    .rightPoiInfo_item>span{
        display: block;
        margin-left: 80px;
        color: #999;
    }
    .rightPoiInfo_item input{
        width: 500px;
    }
    .rightPoiInfo_item textarea{
        resize: none;
        width: 500px;
        height: 50px;
    }

    .ticketInfo_item{
        width: 100%;
        line-height: 30px;
        font-size: 13px;
        margin-bottom: 8px;
    }
    .ticketInfo_item label{
        float:left;
        font-weight: bold;
        width: 80px;
        text-align: right;
    }
    .ticketInfo_item>span{
        display: block;
        margin-left: 80px;
        color: #999;
    }
    #poi_name{
        font-weight: bold;font-size: 20px;margin-left:58px;
    }
    #poi_engname{
        color:#666;font-size: 13px;margin-left:58px;margin-bottom:10px;
    }
    #poi_introduce{
        max-height: 110px;
        overflow: scroll;
        overflow-x: hidden;
        border:1px #eee solid;
        padding: 8px;
    }
    .poi-detail-item-title{
        font-size: 24px !important;
        max-width:200px;
        line-height:30px !important;
    }
    .poi-detail-item-title1{
        font-size: 18px !important;
        max-width:200px;
        line-height:30px !important;
    }
    #rightmap{
        width:100%;
        height:300px;
        line-height: 30px;
        text-align: center;
        display: none;
        margin-bottom:20px;
    }
    #poi_introduce p span{
        margin:0;
    }
    #rightNewPOI .layui-input-inline{
        width: 60%;
    }
    .addressbox,.addressbox span{
        width:100%;
        background: #dfdfdf;
    }

    /*详细定制得样式*/
    .detail-custom-trip{
        display: inline-block;
        float: left;
        margin-right: 10px;
    }
    .layui-form-text{
        display: inline-block;
    }
    .detail-create{
        font-weight: bold;
        color: #fff;
        width: 50px;
        line-height: 1.5;
        display: inline-block;
        font-weight: 400;
        text-align: center;
        -ms-touch-action: manipulation;
        touch-action: manipulation;
        cursor: pointer;
        background-image: none;
        border: 1px solid transparent;
        white-space: nowrap;
        padding: 0 15px;
        font-size: 14px;
        border-radius: 4px;
        height: 28px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-transition: all .3s cubic-bezier(.645,.045,.355,1);
        transition: all .3s cubic-bezier(.645,.045,.355,1);
        /*position: relative;*/
        color: rgba(0,0,0,.65);
        background-color: #fff;
        border-color: #ccc;
    }
    .detail-create span{
        font-weight: bolder;
    }
    .detail-create-list{
        list-style: none;
        display: none;
        outline: 0;
        position: absolute;
        padding: 0 !important;
        margin-top: 10px;
        width: 270px;
        text-align: center;
        background-color: #fff;
        border-radius: 4px;
        -webkit-box-shadow: 0 2px 8px rgba(0,0,0,.15);
        box-shadow: 0 2px 8px rgba(0,0,0,.15);
        background-clip: padding-box;
        z-index: 99999 !important;
    }
    .detail-create-list :hover{
        background: #e3e3e3;
    }
    .detail-create-list li{
        float: left;
        width: 82px;
        list-style: none !important;
        padding: 6px 0;
        margin: 4px !important;
        text-align: center;
        /*clear: both;*/
        font-size: 14px;
        font-weight: 400;
        color: rgba(0,0,0,.65);
        white-space: nowrap;
        cursor: pointer;
        -webkit-transition: all .3s;
        transition: all .3s;
        line-height: 22px;
    }
    .detailcustomshow{
        display: block;
    }
    /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
    ::-webkit-scrollbar
    {
        width: 5px;  /*滚动条宽度*/
        /*height: 5px;*/
    }

    /*定义滚动条轨道 内阴影+圆角*/
    ::-webkit-scrollbar-track
    {
        /*滚动条的背景区域的内阴影*/
        box-shadow:0px 1px 3px rgba(0,0,0,0.3) inset;

        /*滚动条的背景区域的圆角*/
        border-radius: 10px;

        /*滚动条的背景颜色*/
        background-color: #ddd;
    }

    /*定义滑块 内阴影+圆角*/
    ::-webkit-scrollbar-thumb
    {
        /*滚动条的内阴影*/
        box-shadow:0px 1px 3px rgba(0,0,0,0.3) inset;

        /*滚动条的圆角*/
        border-radius: 10px;

        /*滚动条的背景颜色*/
        background-color: #1E9FFF;
    }
    .border-d2{
        border: 1px solid #d2d2d2;
        padding: 8px;
    }
    .item-toggle,.hideDayMapBtn{
        float: right;
        color: #009688;
    }
    .uploadimgbox img{
        height: 60px;
    }
    .distance{
        height: 20px;
    }
    .distance-list{
        height: 20px;
        margin-top: -25px;
        margin-bottom: 7px;
    }
    .distance-list-car{
        font-size: 12px;
        color: #CCCCCC;
    }
    .allImgArr,#poiImgShow{
        width: 500px;
        min-height: 80px;
    }
    .allImgArr img{
        width: 90px;
        height: 60px;
    }
    .allImgArr{
        padding: 8px;
        background: #eee;
    }
    #poiImgShow i{
        color:red
    }
    .activeinput{
        background: #ffe9001a;
        /*border: 1px solid #ffe9001a;*/
    }
    .rightPoiInfo_item_submit{
        text-align: center;
        background: #009688;
        width: 30%;
        margin-top: 20px;
        /*margin-left: 22%;*/
    }
    .rightPoiInfo_item_span{
        width: 500px;
        text-align: center;
    }

    /*包车自驾样式*/
    .layui-Travel{
        padding: 10px;
        /*transform:rotateX(180deg);*/
    }
    /*滑块得高度*/
    .noUi-vertical .noUi-handle{
        top: 0;
        height: 17px;
        background: #1E9FFF;
    }
    /*交通配置样式*/
    .trafficCar{
        margin-left: 10px;
        font-size: 14px;
        color: #999;
        display: inline-block;
        width: 350px;
        min-height: 30px;
        /*padding: 1px 0;*/
        /*text-align: center;*/
        /*background: #eee;*/
        border-radius: 5px;
        border: 1px dotted #999999;
    }
    .layui-timeline-title{
        height:auto;
        min-height: 30px;
        line-height: 30px;
    }
    .changeReplaceDirector{
        width: 120px !important;
        text-align: center;
    }
    .changeReplaceDirector .layui-form-switch{
        margin-top:0;
        width:74px;
    }
    .changeReplaceDirector .layui-form-switch em{
        width: 60px;
    }
    .changeReplaceDirector .layui-form-onswitch i{
        left: 64px;
    }
    .trafficCar p{
        background: #ff98008f;
        /* width: 60px;
         height: 22px;
         line-height: 22px;
         padding: 0 5px;
         font-size: 12px;
         color: #fff;
         background: #1E9FFF;*/
    }
    .trafficCar_label{
        font-size:16px;
        padding: 0 8px;
    }
    .trans_type_close{
        float: right;
        margin-right: 20px;
        color:red;
    }
    .activetrafficCar{
        border: 2px solid #1E9FFF;
    }
    .box-price{
        /*width: 98.5%;*/
        min-height: 820px;
        margin:0 auto;
        padding: 0 5px;
        overflow-x: scroll;
    }
    /*去掉表格鼠标滑过得样式 .layui-table-hover*/
    .layui-table tbody tr:hover{
        background: #fff;
    }

    .table-input{
        margin-top:5px;
    }
    .table-input-text{
        margin-top:5px;
    }


    /* .switcherset{
         display: none;
     }*/
    .box-price ::placeholder{
        color: #CCCCCC;
    }
    .staff-not{
        text-align: center;
    }

    .inblock{
        display: inline-block;
    }
    .hotel-dealis{
        margin-top: 5px;
    }
    .hidden{
        display: none
    }
    #summaryPricingTable td input{
        width:70%;
        margin-left: 8px;
    }
    .money-unit-symbol{
        float: left;
        height: 30px;
        line-height: 30px;
        margin-right:8px;
    }
    .staff-have{
        display: none;
    }
    .symbolPrice{
        height: 30px;
        line-height: 30px;
        display: inline-block;
    }
    .money-unit-symbol-Price{
        display: inline-block;
        margin-right:8px;
    }
    .totalCarPrice{
        height: 30px;
        line-height: 30px;
    }


    /*遮罩*/
    .box{
        display: none;
        position:absolute;
        top:0;
        bottom:0;
        left:0;
        right:0;
        background:#000;
        opacity:0.4;
        width: 100%;
        height: 100%;
        z-index: 11;
        text-align: center;
    }
    .box img{
        width: 90%;
        height: 100%;
    }
    .setReturnJourney{
        font-size: 10px;
        color:#1E9FFF;
    }

    .radius_div{
        display:inline-block;
        float:left;
        font-size:14px;
        margin-top:1px;
        margin-right:5px;
        width: 22px;
        height: 22px;
        border: 1px solid blue;
        border-radius: 22px;
        /*background-color: #0FF;*/
        opacity: 0.5;
    }
</style>
<style>
    .layui-form {
        margin: 15px 0;
    }
    .layui-form-label {
        width: 100px;
        text-align: left;
    }
    .layui-tab {
        border: 1px solid #00F7DE;
    }
    .tab-ul {
        width: 100%;
    }
    .tab-ul li dd {
        /*width: 13.28%;*/
        height: 60px;
        float: left;
        flex: 1;
        /*border: 1px solid #007DDB;*/
    ;
    }
    .tab-ul-title {
        height: 30px;
        /*width: 50%;*/
        text-align: center;
        line-height: 30px;
        font-size: 16px;
        font-weight: bold;
        /*border: 1px solid #007DDB;*/
        border-bottom: 0
    }
    .week-title td {
        text-align: center;
    }
    .layui-table td {
        padding: 0px!important;
    }
    .input_div {
        /*width: 80px;*/
        margin: 5px auto;
    }
    .ri,
    .ri-w {
        padding: 14px 25px;
        background: #eee;
        text-align: center;
    }
    .batch {
        float: right;
        margin-left: 10px;
    }
    .emptys {
        color: #00F7DE;
    }
    #setPriceShade,#setNewPriceShade {
        /*width: 100%;
        height: 100%;*/
        display: none;
    }
    .bj {
        background: #ff7d00 !important;
        color:#fff !important;
    }
    .tas {
        overflow: hidden
    }

    .layui-table tbody tr:hover {
        background-color: ' ' !important;
    }
    .titl{
        padding: 5px 15px;
        width: 100%;
        text-align: center;
        font-size: 16px;
    }
    .light_star{
        background:#fff;
    }
    .new_star{
        background:greenyellow;
    }
    /*.light_star:after{*/
    /*content:'*';*/
    /*width: 0;*/
    /*height: 0;*/
    /*color: red;*/
    /*margin-left: 4px;*/
    /*}*/
    .new_star:after{
        content:'*';
        width: 0;
        height: 0;
        color: deepskyblue;

    }
    .tabto{
        margin-top: 30px;
    }
    .tabto td{
        background: #eee;
    }
    .tabto input{
        border: none;
        background: #eee;
    }
    #specsPriceSnap table tr td input{
        border: none;
    }
    .person_price_input{
        background: #fff !important;
    }
    .personlog{
        height: auto;
        text-align: left;
    }
    .delPersonlog{
        margin-left: 8px;
        margin-right: 16px;
        color:red
    }
    .day_price,.day_price_no{
        text-align: center;
        color: #ff7d00;
        height: 30px;
        line-height: 30px;
        background: #fff;
    }
    .day_price_no{
        background: #eee;
    }
    .specBatchBtn{
        position: absolute;
        right: 70px;
        top: 65px;
    }
    #setNewPriceShade li{
        width:100%;
        float: left;
    }
    .boldsp{
        font-weight: bold;
    }
    .redsp{
        color:red;
    }
    #specs_table{
        border: groove;
    }
    #sale_details {
        height:400px;
    }
</style>
<link rel="stylesheet" href="__PUBLIC__/drag/drag.css"  media="all">
<body>
<div>
    <div class="layui-card">
        <div>
            <form class="layui-form" id="customer" action="">
                <input type="hidden" id="tripid" name="tripid" value="{notempty name='$tripid'}{$tripid}{/notempty}" autocomplete="off">
                <div>
                    <div class="layui-card-header">门票信息</div>
                    <div class="layui-card-body" style="margin-left:-50px;">
                        <div class="travelulone">
                            <div style="width:120px;text-align: right">
                                <span>门票名称:</span>
                            </div>
                            <input name="name" id="name" value="{notempty name='$trip.name'}{$trip.name}{/notempty}" lay-verify="required" autocomplete="off" class="layui-input custom_input" type="text" style="width:60%;">
                            <div class="material_data">
                                <button class="unifybut" lay-submit lay-filter="customer" style="margin-bottom:0px;">保存</button>
                                <span style="color:red;">（修改以后请点击保存完成更新）</span>
                            </div>
                        </div>
                        <div class="travelulone">
                            <div style="width:120px;text-align: right">
                                <span>产品编号:</span>
                            </div>
                            <input name="item_num" id="item_num" value="{notempty name='$trip.item_num'}{$trip.item_num}{/notempty}" lay-verify="required" autocomplete="off" class="layui-input custom_input" type="text" style="width:200px;">
                        </div>
                        <div class="travelulone">
                            <div style="width:120px;text-align: right">
                                <span>服务语言:</span>
                            </div>
                            <div style="width:300px;margin-left:5px;font-size:12px;">
                                <select name="service_language" id="service_language" lay-filter="service_language" lay-search="">
                                    <option value="0" {if !empty($trip.service_language) && $trip.service_language=='0'} selected{/if}>中文</option>
                                    <option value="1" {if !empty($trip.service_language) && $trip.service_language=='1'} selected{/if}>英文</option>
                                </select>
                            </div>
                        </div>
                        <div class="travelulone">
                            <div style="width:120px;text-align: right">
                                <span>采购渠道:</span>
                            </div>
                            <div class="layui-inline" style="width:150px;margin-left:5px;font-size:12px;">
                                <select id="buyType" lay-filter="buyType" lay-search="">
                                    <option value="supplier" {if !empty($trip['supplier_id'])} selected{/if}>供应商</option>
                                    <option value="driver" {if !empty($trip['driver_id'])} selected{/if}>司导</option>
                                </select>
                            </div>
                            <div class="layui-inline driver_div" {if !empty($trip['driver_id'])} selected{/if} style="width:700px;margin-left:5px;font-size:12px;{if empty($trip.driver_id)}display:none;{/if}">
                            <input type="hidden" id="driver_str" name="driver_str" value="{notempty name="$trip.driver_str"}{$trip.driver_str}{/notempty}">
                            <select name="driver_id" id="driver_id" lay-filter="driver_id" lay-search="">
                                {if !empty($trip['driver_id'])}
                                <option value="{trip.driver_id}">{$trip.driver_str}</option>
                                {else}
                                <option value="" disabled selected hidden>请输入司导姓名后回车查询</option>
                                {/if}
                            </select>
                        </div>
                        <div class="layui-inline supplier_div" style="width:300px;margin-left:5px;font-size:12px;{if !empty($trip.driver_id)}display:none;{/if}">
                            <select name="supplier_id" id="supplier_id" lay-search="">
                                <option value="" >供应商</option>
                                <option value="999999" {if  isset($trip['supplier_id']) AND "999999"==$trip['supplier_id']} selected{/if}>自营</option>
                                {volist name='supplier' id='vo'}
                                <option value="{$vo.id}" {if  isset($trip['supplier_id']) AND $vo.id==$trip['supplier_id']} selected{/if}>{$vo.name}</option>
                                {/volist}
                                <option value="1000000" {if  isset($trip['supplier_id']) AND "1000000"==$trip['supplier_id']} selected{/if}>其他</option>
                            </select>
                        </div>
                        <div class="layui-inline supplier_div" style="font-size:12px;margin-top:3px;margin-left:10px;margin-right:50px;{if !empty($trip.driver_id)}display:none;{/if}">
                            <a href="javascript:void(0);" style="text-decoration:underline;color:blue;" id="toSupplier">查看供应商</a>
                        </div>
                        <div class="supplier_div" style="width:200px;text-align: right;{if !empty($trip.driver_id)}display:none;{/if}" >
                            <span>产品编号（供应商）:</span>
                        </div>
                        <input name="supplier_item_code" id="supplier_item_code" value="{notempty name='$trip.supplier_item_code'}{$trip.supplier_item_code}{/notempty}" autocomplete="off" class="layui-input custom_input supplier_div" type="text" {if !empty($trip.driver_id)}style="display:none;"{/if}>
                    </div>
                    <div class="travelulone">
                        <div style="width:120px;text-align: right">
                            <span style="color:green;">上次更新人:</span>
                        </div>
                        <input id="update_admin" value="{notempty name='$trip.update_admin'}{$trip.update_admin}{/notempty}" autocomplete="off" class="layui-input custom_input" type="text" disabled style="margin-right:-10px;">
                        <div style="width:100px;text-align: right;margin-left:5px;">
                            <span style="color:green;">上次更新时间:</span>
                        </div>
                        <input id="update_time" value="{notempty name='$trip.update_time'}{$trip.update_time}{/notempty}" autocomplete="off" class="layui-input custom_input" type="text" disabled style="width:200px;">
                    </div>
                </div>
                <div class="layui-card-header" style="margin-top:-20px;">售卖信息</div>
                <div class="layui-card-body" style="margin-left:-30px;">
                    <div class="travelulone">
                        <div style="width:150px;text-align: right">
                            <span>售卖日期:</span>
                        </div>
                        <div class="layui-input-inline" style="margin-left:5px;">
                            <input name="sale_starttime" id="sale_starttime" value="{notempty name='$trip.sale_starttime'}{$trip.sale_starttime}{/notempty}" placeholder="请输入" autocomplete="off" class="layui-input"  type="text">
                        </div>
                        <div class="layui-input-inline" style="width:20px;height:40px;margin-left: 7px;line-height: 30px">至</div>
                        <div class="layui-input-inline">
                            <input name="sale_endtime" id="sale_endtime" value="{notempty name='$trip.sale_endtime'}{$trip.sale_endtime}{/notempty}" placeholder="请输入" autocomplete="off" class="layui-input"  type="text">
                        </div>
                    </div>
                    <div class="travelulone">
                        <div style="width:150px;text-align: right">
                            <span>售卖日期详情:</span>
                        </div>
                        <div class="layui-inline" style="width:420px;margin-left:5px;margin-right:30px;">
                            <textarea placeholder="请输入售卖日期详情" class="layui-textarea" name="saletime_more" id="saletime_more" style="min-height:150px;max-height:500px;">{notempty name="$trip.saletime_more"}{$trip['saletime_more']}{/notempty}</textarea>
                        </div>
                        <div style="width:150px;text-align: right">
                            <span>预订流程:</span>
                        </div>
                        <div class="layui-inline" style="width:420px;margin-left:5px;margin-right:30px;">
                            <textarea placeholder="请输入" class="layui-textarea" name="reservation" id="reservation" style="min-height:150px;max-height:500px;">{notempty name="$trip.reservation"}{$trip['reservation']}{/notempty}</textarea>
                        </div>
                    </div>
                    <!--<div class="travelulone">-->
                        <!--<div style="width:150px;text-align: right">-->
                            <!--<span>内部备注:</span>-->
                        <!--</div>-->
                        <!--<div class="layui-inline" style="width:420px;margin-left:5px;margin-right:30px;">-->
                            <!--<textarea placeholder="请输入" class="layui-textarea" name="description" id="description" style="min-height:150px;max-height:500px;">{notempty name="$trip.description"}{$trip['description']}{/notempty}</textarea>-->
                        <!--</div>-->
                    <!--</div>-->
                </div>
                <div class="layui-card-header" style="margin-top:-20px;">其他</div>
                <div class="layui-card-body" style="margin-left:-30px;">
                    <div class="travelulone">
                        <!--<div style="width:150px;text-align: right">-->
                            <!--<span>简介:</span>-->
                        <!--</div>-->
                        <!--<div class="layui-inline" style="width:420px;margin-left:5px;margin-right:30px;">-->
                            <!--<textarea placeholder="请输入" class="layui-textarea" name="introduction" id="introduction" style="min-height:150px;max-height:500px;">{notempty name="$trip.introduction"}{$trip['introduction']}{/notempty}</textarea>-->
                        <!--</div>-->
                        <div style="width:150px;text-align: right">
                            <span>退改规则:</span>
                        </div>
                        <div class="layui-inline" style="width:420px;margin-left:5px;">
                            <textarea placeholder="请输入" class="layui-textarea" name="back" id="back" style="min-height:150px;max-height:500px;">{notempty name="$trip.back"}{$trip['back']}{/notempty}</textarea>
                        </div>
                        <div style="width:150px;text-align: right">
                            <span>注意事项:</span>
                        </div>
                        <div class="layui-inline" style="width:420px;margin-left:5px;margin-right:30px;">
                            <textarea placeholder="请输入" class="layui-textarea" name="careful" id="careful" style="min-height:150px;max-height:500px;">{notempty name="$trip.careful"}{$trip['careful']}{/notempty}</textarea>
                        </div>
                    </div>
                </div>

                <!--<div class="layui-card-header" style="margin-top:-20px;">售卖详情页编辑</div>-->
                <!--<div class="layui-card-body" style="margin-left:-70px;">-->
                    <!--<div class="travelulone">-->
                        <!--<div style="width:150px;text-align: right">-->
                            <!--<span>详情简介:</span>-->
                        <!--</div>-->
                        <!--<div style="width:75%;margin-left:5px;height:400px;">-->
                            <!--<textarea placeholder="请输入" class="layui-textarea" name="sale_details" id="sale_details" style="height:300px;">{notempty name="$trip.sale_details"}{$trip['sale_details']}{/notempty}</textarea>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
            </form>
        </div>

        <div class="layui-card-header" style="margin-top:-40px;">门票套餐</div>
        <div class="layui-card-body" style="margin-left:-40px;margin-bottom:20px;">
            <form class="layui-form">
                <div class="travelulone">
                    <div style="width:120px;">
                        <span style="padding:9px 15px;text-align: left;font-size:14px;font-weight:400;">规格类型</span>
                    </div>
                    <div style="width:300px;margin-left:5px;font-size:12px;">
                        <select name="specs_type" id="specs_type" lay-filter="specs_type" lay-search="">
                            <option value="1" {if !empty($trip.specs_type) && $trip.specs_type=='1'} selected{/if}>人群</option>
                            <option value="2" {if !empty($trip.specs_type) && $trip.specs_type=='2'} selected{/if}>车型</option>
                        </select>
                    </div>
                </div>
            </form>

            <div class="travelulone">
                <div style="margin-left:15px;" class="setPackage layui-btn layui-btn-sm layui-btn-default">设置套餐</div>
            </div>

            {volist name="package" id="vo"}
            <div class="travelulone">
                <div class="layui-form-item packageChild">
                    <label class="layui-form-label">套餐名称</label>
                    <div class="layui-input-inline" style="width: 500px">
                        <input type="hidden" name="package_id" id="package_id" value="{$vo.id}">
                        <div class="layui-input-inline" style="width: 400px;padding-bottom: 15px">
                            <input disabled value="{$vo.name}"  placeholder="套餐名称" autocomplete="off" class="layui-input" type="text" lay-key="1">
                        </div>
                    </div>
                    <div class="layui-form-item childs">
                        <label class="layui-form-label">&nbsp;</label>
                        <div class="layui-input-inline" style="width: 750px">
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th>{$table_name[0]}</th>
                                    <th>{$table_name[1]}</th>
                                </tr>
                                </thead>
                                <tbody class="specsChild">
                                {volist name="vo['specs'][0]" id="vo1"}
                                <tr>
                                    <td style="height:40px;text-align: center">
                                        {$vo1.name}
                                    </td>
                                    <td style="height:40px;text-align: center">
                                        {if $trip.specs_type==1}
                                        {$vo1.min_age}岁 至 {$vo1.max_age}岁
                                        {else}
                                            {if $vo1.car_type==1}
                                            5座车
                                            {elseif $vo1.car_type==10}
                                            7座车
                                            {elseif $vo1.car_type==20}
                                            12座车
                                            {/if}
                                        {/if}
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            {/volist}

        </div>

        <div class="layui-card-header" style="margin-top:-20px;">售价日历</div>
        <div class="layui-card-body" style="margin-left:-20px;margin-bottom:20px;">
            <form class="layui-form">
                <div class="travelulone" style="margin-left:-14px;">
                    <div>
                        <span style="padding:9px 15px;text-align: left;font-size:14px;font-weight:400;">货币类型：</span>
                    </div>
                    <div style="width:300px;font-size:12px;">
                        <input type="hidden" id="" value="">
                        <select name="currency" id="currency" lay-filter="currency" lay-search="">
                            {volist name='currencyList' id='currency'}
                            <option value="{$currency.currency_code}" {if !empty($trip.currency) && $trip.currency==$currency.currency_code} selected{/if}>{$currency.currency_name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
            </form>
            <div class="travelulone" style="margin-left:-14px;">
                <div>
                    <span style="padding:9px 15px;text-align: left;font-size:14px;font-weight:400;">售卖利率：</span>
                </div>
                <div style="width:300px;font-size:12px;">
                    <input type="number" max="3.00" min="0.01" step="0.1" id="ticket_rate" value="{notempty name='$trip.ticket_rate'}{$trip.ticket_rate}{/notempty}" name="ticket_rate" class="layui-input" lay-verify="required">
                </div>
                <div>
                    <button class="layui-btn layui-btn-sm" id="changeRate" style="margin-left:5px;">修改</button>
                </div>
            </div>

            <form class="layui-form">
                <input type="hidden" id="starttime" value="{notempty name='$trip.sale_starttime'}{$trip.sale_starttime}{/notempty}" placeholder="开始时间" class="layui-input" />
                <input type="hidden" id="endtime" value="{notempty name='$trip.sale_endtime'}{$trip.sale_endtime}{/notempty}" placeholder="结束时间" class="layui-input" />
                <input type="hidden" id="product_id" value="{$tripid}" />
                <ul>
                    <li>
                        <div class="layui-tab" lay-filter="package" style="margin:0">
                            <div id="tab-title">
                                <ul class="layui-tab-title Spec">

                                </ul>
                            </div>
                            <div class="layui-tab-content content" style="overflow: auto;">

                            </div>
                        </div>
                    </li>
                </ul>
            </form>

            <!--普通成本弹层-->
            <div id="setPriceShade">
                <form class="layui-form" action="" method="post" name="setPriceShade">
                    <input type="hidden" id="specs_ids" value="" />
                    <ul>
                        <li>
                            <div class="layui-form-item" style="margin: 0;">
                                <label class="layui-form-label">售卖日期:</label>
                                <div class="layui-input-inline layui-col-md5">
                                    <input type="text" value="{notempty name='$trip.sale_starttime'}{$trip.sale_starttime}{/notempty}" disabled placeholder="开始时间" class="layui-input" readonly />
                                </div>
                                <div style=" text-align: center;line-height: 38px;width: 25px;height: 38px;float: left;margin:5px 10px 5px 0;">至</div>
                                <div class="layui-input-inline layui-col-md6">
                                    <input type="text" value="{notempty name='$trip.sale_endtime'}{$trip.sale_endtime}{/notempty}" disabled placeholder="结束时间" class="layui-input" readonly />
                                </div>
                            </div>
                        </li>
                        <li class="time-content">
                            <div class="layui-form-item shijian" style="margin: 0;">
                                <label class="layui-form-label">选择时间段:<br><span style="font-size: 12px;">(时间为当地时间)</span></label>
                                <div class="layui-input-inline layui-col-md5">
                                    <input type="text" name="t-starttime" value="" autocomplete='off' placeholder="开始时间" class="layui-input x" />
                                </div>
                                <div style="text-align: center;line-height: 38px;width: 25px;height: 38px;float: left;margin-right: 10px;">至</div>
                                <div class="layui-input-inline layui-col-md6">
                                    <input type="text" name="t-endtime" value="" autocomplete='off' placeholder="结束时间" class="layui-input x" />
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item" style="margin: 0;">
                                <label class="layui-form-label">&nbsp;</label>
                                <div class="layui-input-inline layui-col-md12">
                                    在以上时间段中选择：
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item " id="selectTimeForm">


                            </div>
                            <div class="layui-form-item " id="moreTimeForm" style="display: none;">
                                <label class="layui-form-label">&nbsp;</label>
                                <div class="layui-input-block layui-col-xs8" style="margin: 0;">
                                    <input style="width:160px;" type="text" name="moreTime" autocomplete='off' value="" placeholder="开始时间" class="layui-input layui-input-inline x" />
                                    <a class="layui-btn layui-btn-sm layui-btn-normal addMoreTime" style="margin-top:8px;">添加</a>
                                </div>
                                <div class="layui-input-block layui-col-xs8" style="margin-left:130px;background: #eee;width:620px;">
                                    <div style="width:620px;min-height:50px;" id="moreTimeArr">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li id="specsPriceSnap">
                            <div class="layui-input-block layui-col-xs10" style="margin-left:130px;">
                                <input type="hidden" id="exchangeNum" value="{$exchangeNum}">
                                <table class="layui-table">
                                    <thead>
                                    <tr>
                                        <th>名称</th>
                                        <th>成本价（{$currencyName}）</th>
                                        <th>利率</th>
                                        <th>汇率（{$currencyName}）</th>
                                        <th>售卖价</th>
                                        <th>数量</th>
                                        <th>最低下单数</th>
                                        <th>最小增长数</th>
                                    </tr>
                                    </thead>
                                    <tbody class="batch_person">

                                    </tbody>
                                </table>
                            </div>
                        </li>
                    </ul>
                </form>
            </div>
        </div>
    </div>
    <div style="width: 100%;height: 1px;background: #efefef"></div>

    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script>
        //当前地图是否可见
        layui.use(['layer', 'laydate', 'form'], function() {
            var layer = layui.layer,
                $ = layui.jquery,
                form = layui.form;
            var laydate = layui.laydate;
            laydate.render({     //创建时间选择框
                elem: '#sale_starttime' //指定元素
                ,format: 'yyyy-MM-dd'
            });
            var laydate2 = layui.laydate;
            laydate2.render({     //创建时间选择框
                elem: '#sale_endtime' //指定元素
                ,format: 'yyyy-MM-dd'
            });

            $('.poiImg_btn').click(function(){
                var id = $(this).attr('data-poiid');
                var url="/admin/trip/addpoiimg/id/"+id+".shtml";
                layer.open({
                    type:2,
                    content:url,
                    area: ['50%', '90%'],
                    end:function(){
                        return false;
                    }
                });

                return false;
            });
            $('.tripconfig').click(function(){
                var url = "/admin/product/productconfig";
                var id = $(this).attr("data-id");
                layer.open({
                    'type':2,
                    'content':url+"?id="+id,
                    'area':['50%','90%'],
                    'end':function(){

                    }
                })
            });



            //导入行程
            $('.tripimport').click(function(){
                var url = "/admin/product/productimport";
                var id = $(this).attr("data-id");
                layer.open({
                    'type':2,
                    'content':url+"?id="+id,
                    'area':['50%','90%'],
                    'end':function(){
                        window.location.reload();
                    }
                })
            });

            //上传附件
            $('.saveFile').click(function(){
                var url = "/admin/product/savefile";
                var id = $(this).attr("data-id");
                layer.open({
                    'type':2,
                    'content':url+"?id="+id+"&typeid=1",
                    'area':['50%','90%'],
                    'end':function(){
                        window.location.reload();
                    }
                })
            });

            //弹窗的点击事件
            var i=$('#tripid').attr('value');
            if(i<=0){
                var url = "info";
                layer.open({
                    type: 2,
                    content: url,
                    scrollbar: false,
                    title: "新建门票产品",
                    area: ['900px', '500px'],
                    end: function () {
                        var tripid = $('#tripid').attr("value");
                        if(tripid>0){
                            location.href = "/admin/ticket/ticketmake?id="+tripid;
                        }else{
                            location.href = "{:url('admin/ticket/index')}";
                        }
                    }
                });
            }

            //更新信息
            form.on('submit(customer)', function(data) {
                var name=$('#name').val();
                var item_num=$('#item_num').val();
                if(name !=='' && item_num !==''){
                    $.ajax({
                        url:"{:url('/admin/product/changeInfo')}",
                        data:$('#customer').serialize(),
                        type:'post',
                        async: false,
                        success:function(res) {
                            layer.msg(res.msg);
                            if(res.code > 0){
                                location.reload();
                                return false;
                            }
                        }
                    })
                }else{
                    layer.msg('关键信息不能为空！')
                }
                return false;
            });

            //选择采购渠道
            form.on('select(buyType)', function(param){
                var type = param.value;
                if(type=='driver'){
                    $(".supplier_div").hide();
                    $(".driver_div").show();
                    $("#supplier_id").val('');
                    $("#supplier_item_code").val('');
                }else{
                    $(".supplier_div").show();
                    $(".driver_div").hide();
                    $("#driver_id").val('');
                    $("#driver_id").html('<option value="" disabled selected hidden>请输入司导姓名后回车查询</option>');
                    $("#driver_str").val('');
                    $(".driver_div").find("input").val('');
                }
                form.render('select');
                bindDriverFunc();
                return false;
            });

            form.on('select(driver_id)', function(param){
                var text = param.elem[param.elem.selectedIndex].text;
                $("#driver_str").attr("value",text);
                return false;
            });

            //查询司导
            function bindDriverFunc(){
                $(".driver_div input").on('keyup',driverFind);
            }
            function driverFind(e) {
                if (e.keyCode == 13) {
                    var driver_name = $(this).val();
                    $.ajax({
                        url:"{:url('admin/product/getDriverData')}",
                        data:{name:driver_name},
                        type:'post',
                        success:function(data) {
                            if(data.length<1){
                                return false;
                            }
                            var html="<option value=''>请选择司导</option>";
                            for(var i=0;i<data.length;i++){
                                html += "<option value="+data[i]["id"]+">"+data[i]['profile']["name"]+"，"+data[i]['username']+"（"+data[i]['profile']['cityString']+"）"+"</option>";
                            }

                            $("#driver_id").html(html);

                            //重新渲染select
                            form.render('select');
                            $("#driver_id").next().addClass("layui-form-selected");
                            $("#driver_id").next().find("input").focus();
                            $("#driver_id").next().find("input").val(driver_name);
                            bindDriverFunc();
                        }
                    });
                }
                return false;
            }
            bindDriverFunc();


            //标签
            form.on('select(addtrips)', function(data){
                var tripid=data.value;
                $("#addtrips").attr("data-id",tripid);
            });
            $("#addtrips").on("click",function () {
                var tripid= $("#addtrips").attr("data-id");
                var tripids=$("#tripids").val();
                var ids=tripids.split(",");

                if (tripid==999999){
                    tripids=999999;
                    var tripspan='<span class="layui-btn layui-btn-sm layui-btn-normal deltripspan" data-id="999999" style="margin: 5px 10px">全部<i class="layui-icon"></i></span>';
                    $("#tripnames").html(tripspan);
                }else{
                    for(var i=0 ; i < ids.length; i++){
                        if(tripid==ids[i]){
                            layer.msg("不能重复添加商品");
                            return false;
                        }
                        if(ids[i]==999999){
                            tripids=999999;
                            var tripspan='<span class="layui-btn layui-btn-sm layui-btn-normal deltripspan" data-id="999999" style="margin: 5px 10px">全部<i class="layui-icon"></i></span>';
                            $("#tripnames").html(tripspan);
                            $("#tripids").val(tripids);
                            return false;
                        }
                    }
                    var tripname="";
                    $("#triptag").find("option").each(function () {
                        if($(this).val()==tripid){
                            tripname=$(this).html();
                        }
                    });

                    var tripspan='<span class="layui-btn layui-btn-sm layui-btn-normal deltripspan" data-id="'+tripid+'" style="margin: 5px 10px">'+tripname+'<i class="layui-icon"></i></span>';
                    if(!tripids){
                        tripids+=tripid;
                    }else{
                        tripids+=','+tripid;
                    }
                    $("#tripnames").append(tripspan);
                }
                $("#tripids").val(tripids);
            });
            $(document).on("click",'.deltripspan',function () {
                var dataid=$(this).attr("data-id");
                var tripids=$("#tripids").val();
                var ids=tripids.split(",");
                var newid="";
                for(var i=0 ; i < ids.length; i++){
                    if(ids[i]&&dataid!=ids[i]){
                        if(!newid){
                            newid+=ids[i];
                        }else{
                            newid+=","+ids[i];
                        }
                    }
                }
                $("#tripids").val(newid);
                $(this).remove();
            });


            //选择套餐规格类型
            form.on('select(specs_type)', function(param){
                var tripid = $("#tripid").attr("value");
                var specs_type = param.value;
                $.ajax({
                    url:"{:url('/admin/ticket/changeSpecsType')}",
                    data:{"id":tripid,"specs_type":specs_type},
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },500);
                        }
                    }
                });

                return false;
            });

            //修改利率
            $("#changeRate").click(function(){
                var tripid = $("#tripid").attr("value");
                var ticket_rate = $("#ticket_rate").val();
                var currency = $("#currency").val();
                $.ajax({
                    url:"{:url('/admin/ticket/changeRate')}",
                    data:{"id":tripid,"ticket_rate":ticket_rate,"currency":currency},
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },500);
                        }
                    }
                });

                return false;
            });

        });

    </script>
    <script>
        $("#toSupplier").click(function(){
            var supplier_id = $("#supplier_id").val();
            if(supplier_id!=='999999' && supplier_id!=='1000000'){
                var url = "{$kbx_url}"+"/admin/supplier/"+supplier_id;
                window.open(url);
            }
            return false;
        });
    </script>
    <!-- 配置文件 -->
    <!--<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>-->
    <!-- 编辑器源码文件 -->
    <!--<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>-->
    <!--售价日历-->
    <script type="text/javascript">
        var moreTimeList = [];
        layui.use(['layer', 'element', 'form', 'laydate'], function() {
            //套餐获取
            var specsurl = '/admin/product/werk';
            //规格获取
            var posurl = '/admin/product/pos';
            //获取数据
            var starttime = "{$trip.sale_starttime}";
            var endtime = "{$trip.sale_endtime}";
            var personprice = {};
            var id = {$tripid};
            var list = {$dailyPriceData};
            var layer = layui.layer,
                element = layui.element,
                form = layui.form,
                laydate = layui.laydate;

            //重新渲染所有的日期控件
            function renderDateTimeWidget(){
                //重新渲染时间控件
                $('.x').each(function() {
                    laydate.render({
                        elem: this //指定元素
                        ,trigger:'click'
                    });
                });
            }
            renderDateTimeWidget();

            //获取产品全部日期价格集合
            function getPersonPrice(){
                $.ajax({
                    url:"/admin/product/getPrice",
                    type:"POST",
                    dataType:'json',
                    async:false,
                    data:{id:id,sdate:starttime,edate:endtime},
                    success:function (data) {
                        personprice = data.data;
                    }
                })
            }
            getPersonPrice();

            //初始化
            //1-1   获取并渲染产品套餐
            function showSpecsData(){
                $('.Spec').html(''); //清空容器
                var id = $('#product_id').val(); //获取产品id
                var starttime = $('#starttime').val(); //获取开始时间
                var endtime = $('#endtime').val(); //获取结束时间
                if(starttime.length <= 0) {
//                    layer.msg('开始时间不能为空');
                    return false;
                }
                if(endtime.length <= 0) {
//                    layer.msg('结束时间不能为空');
                    return false;
                }

                //开始时间转化时间戳
                var k = parseInt(new Date(starttime + ' 00:00:00').getTime());
                //结束时间转化时间戳
                var j = parseInt(new Date(endtime + ' 23:59:59').getTime());
                //获取当前时间戳
                var d = parseInt(new Date().getTime());
                if(j < k) {
                    layer.msg('结束时间不能小于开始时间');
                    return false;
                }

                //获取套餐
                $.ajax({
                    url: specsurl,
                    type: "post",
                    dataType: "json",
                    data: {
                        id: id
                    },
                    success: function(resData) {
                        if(resData.code==-1){
                            layer.msg("请先添加套餐");
                            return false;
                        }
                        resData = resData.data;
                        var packageHtml = ''; //套餐表头html
                        var priceHtml = ''; //价格内容html
                        $('.content').html('');
                        $.each(resData, function(i, v) {
                            var thisHtml = '';
                            var thisShowHtml = '';
                            if(i==0) {
                                thisHtml = 'class="layui-this"';
                                thisShowHtml = 'layui-show';
                            }else{
                                thisHtml = '';
                                thisShowHtml = '';
                            }
                            var package_id = v.id;
                            var normalSet = '<div date-pid="' + package_id + '" class="batch addBatch layui-btn layui-btn-sm layui-btn-normal" style="display: none;">普通成本</div>';
                            packageHtml += '<li id="top' + package_id + '"' + thisHtml + 'data-id="' + package_id + '">' + v.name + '</li>';
                            priceHtml += '<div class="layui-tab-item '+ thisShowHtml +'" id="yue' + package_id + '">' +
                                '<ul class="tab-ul">' +
                                '<li class="tab-ul-title specBatchBtn">' +
                                '<div date-pid="' + package_id + '" class="batch deleteBatch layui-btn layui-btn-sm layui-btn-danger">批量删除</div>' +
                                '<div date-pid="' + package_id + '" class="batch setBtn layui-btn layui-btn-sm layui-btn-default">设置价格</div>' +
                                normalSet +
                                '<div date-pid="' + package_id + '" class="batch addNewBatch layui-btn layui-btn-sm layui-btn-default" style="display: none;">包车成本</div>' +
                                '<div date-pid="' + package_id + '" class="batch setGoodsRate layui-btn layui-btn-sm layui-btn-warm" style="display: none;">成本系数</div>' +
                                '</li>' +
                                '</ul>' +
                                '<div class="layui-tab yue_div">' +
                                '<ul class="layui-tab-title" id="yue">' +
                                '</ul>' +
                                '<div class="layui-tab-content tas" id="tas' + package_id + '">' +
                                '</div>' +
                                '</div>' +
                                '<div class="layui-form-item ">' +
                                '</div>' +
                                '</div>' +
                                '</div>';
                            $('.Spec').html(packageHtml);
                            $('.content').html(priceHtml);
                        });
                        addhtm(starttime,endtime,resData);
                    },
                    error: function(jqXHR) {
                        console.log(jqXHR);
                    }
                });
            }
            $(document).ready(function(){
                showSpecsData();
            });

            //2-1       渲染价格日历、规格
            function addhtm(starttime,endtime,resData) {
                var package_id = resData[0].id;
                $.ajax({
                    url: posurl,
                    type: "post",
                    dataType: "json",
                    data: {
                        'package_id': package_id
                    },
                    success: function(data) {
                        yue(starttime, endtime, package_id, data);
                    },
                    error: function(jqXHR) {
                        console.log(jqXHR);
                    }
                });
            }
            //2-2       获取区间内的月份
            function yue(starttime, endtime, package_id, data) {
                var da = getMonthAll(starttime, endtime);
                var month = '';
                $('#tas' + package_id).html('');
                for(var i = 0; i < da.length; i++) {
                    var year = da[i].split('-');
                    if(i == 0) {
                        month += '<li class="layui-this" lay-id="' + i + '">' + year[0] + '年' + year[1] + '月</li>';
                    } else {
                        month += '<li  lay-id="' + i + '">' + year[0] + '年' + year[1] + '月</li>';
                    }
                    var tasHtml = datetime(da[i], i, data, package_id, starttime, endtime);
                    $('#tas' + package_id).append(tasHtml);
                    //高亮第一个时间
                    $(".ri:first").click();
                }
                $('#yue' + package_id + ' #yue').html('');
                $('#yue' + package_id + ' #yue').prepend(month);
            }
            //2-2-1     查询时间维度里的所有月份
            function getMonthAll(starttime, endtime) {
                var d1 = starttime;
                var d2 = endtime;
                var dateArry = new Array();
                var s1 = d1.split("-");
                var s2 = d2.split("-");
                var mCount = 0;
                if(parseInt(s1[0]) < parseInt(s2[0])) {
                    mCount = (parseInt(s2[0]) - parseInt(s1[0])) * 12 + parseInt(s2[1]) - parseInt(s1[1]) + 1;
                } else {
                    mCount = parseInt(s2[1]) - parseInt(s1[1]) + 1;
                }
                if(mCount > 0) {
                    var startM = parseInt(s1[1]);
                    var startY = parseInt(s1[0]);
                    for(var i = 0; i < mCount; i++) {
                        if(startM < 12) {
                            dateArry[i] = startY + "-" + (startM > 9 ? startM : "0" + startM);
                            startM += 1;
                        } else {
                            dateArry[i] = startY + "-" + (startM > 9 ? startM : "0" + startM);
                            startM = 1;
                            startY += 1;
                        }
                    }
                }
                return dateArry;
            }
            //2-2-2     渲染日历
            function datetime(up, d, data, package_id, starttime, endtime) {
                starttime = starttime.split("-");
                endtime = endtime.split("-");
                up = up.split("-");
                var da = new Date(up[0], up[1], 0);
                //获取每月有多少天
                var day = da.getDate(); //获取当前月有多少天
                da.setDate(1);
                var we = da.getDay(); //获取当前月的第一天是星期几
                var a = 0;
                var str = '';
                var tr = '';
                var tab = ''; ///每一天的tab
                if(d == 0) {
                    tr += '<div class="layui-tab-item layui-show">';
                } else {
                    tr += '<div class="layui-tab-item">';
                }
                tr += "<div class='layui-col-md6'>";
                tr += '<table class="layui-table">' +
                    '<div class="titl">' + up[0] + '年' + up[1] +'月</div>'+
                    '<thead>' +
                    '<tr class="week-title">' +
                    '<td>星期日</td>' +
                    '<td>星期一</td>' +
                    '<td>星期二</td>' +
                    '<td>星期三</td>' +
                    '<td>星期四</td>' +
                    '<td>星期五</td>' +
                    '<td>星期六</td>' +
                    '</tr>' +
                    '</thead>' +
                    '<tbody class="tian">';

                for(var i = 1; i <= day + we; i++) {
                    a++;
                    if(i > we) {
                        //按时间段渲染日历
                        var light = '';
                        var firstPrice = '';
                        var day_price_str = "";
                        var u = i - we;
                        var str_class = up[0] + '-' + up[1] + '-' + (u > 9 ? u : '0' + u) + '">' + (u > 9 ? u : '0' + u);
                        var str_day = up[0] + '-' + up[1] + '-' + (u > 9 ? u : '0' + u);
                        if(str_day+','+package_id in personprice){
                            light = 'light_star show';
                            var day_index = str_day+','+package_id;
                            firstPrice = personprice[day_index][0]['price'] || "";
                        }
                        if(firstPrice!=""){
                            day_price_str = '<div class="day_price"><p style="width:80%;margin:0 auto;border-top:1px solid #ddd">¥'+firstPrice+'</p></div>';
                        }else{
                            day_price_str = '<div class="day_price_no"></div>';
                        }
                        if(u < starttime[2] && up[0] == starttime[0] && up[1] == starttime[1] || u > endtime[2] && up[0] == endtime[0] && up[1] == endtime[1]) {
                            str += '<td>' +
                                '<div class="ri-w '+light+'" date-specs="' + package_id + '" date-ri="' + str_class +'</div>' + day_price_str +
                                '</td>';
                        } else {
                            str += '<td>' +
                                '<div class="ri '+light+'" date-specs="' + package_id + '" date-ri="' + str_class +'</div>' + day_price_str +
                                '</td>';
                        }
                    } else {
                        str += '<td></td>';
                    }
                    if(a == 7 || i == day + we) {
                        tr += '<tr>' + str + '</tr>';
                        str = '';
                        a = 0;
                    }
                    if(u === undefined) {

                    } else {
                        if(u < starttime[2] && up[0] == starttime[0] && up[1] == starttime[1] || u > endtime[2] && up[0] == endtime[0] && up[1] == endtime[1]) {

                        } else {
                            var time = up[0] + '-' + up[1] + '-' + (u > 9 ? u : '0' + u);
                            tab += '<div class="person_off " id="' + up[0] + '-' + up[1] + '-' + (u > 9 ? u : '0' + u) + '" style="display: none;">' +
                                '<table class="layui-table">';
                            tab += '<thead><tr><th>名称</th><th>成本（{$currencyName}）</th><th>利率</th><th>设置时汇率（{$currencyName}）</th><th>售价（￥）</th></tr></thead>';
                            tab += '<tbody>';

                            //循环人群
                            //默认使用套餐数据填充 改用真实数据填充 2019-03-19
                            var oldperson = list[time+","+package_id];
                            if(oldperson!==undefined && oldperson!==null){
                                data = oldperson;
                            }else if(time+','+package_id in personprice){
                                data = personprice[time+","+package_id];
                            }
                            for(var j = 0; j < data.length; j++) {
                                var exchangeNum = '';
                                if(data[j].exchange_num!==undefined){
                                    exchangeNum = data[j].exchange_num;
                                }
                                var dayTitle = up[0] + '-' + up[1] + '-' + (u > 9 ? u : '0' + u);
                                tab += '<tr date-trd="' + dayTitle + '" date-person="' + data[j].person_id + '" >' +
                                    '<td><input readonly type="text" name="person_name" date-aid="' + data[j].id + '" date-rq="' + dayTitle + '" class="layui-input input_div" placeholder="名称" value="' + data[j].name + '" /></td>' +
                                    '<td><input readonly type="number" autocomplete="off" name="person_price" date-dayid="' + data[j].id + '" date-rq="' + dayTitle + '" class="layui-input person_price_input input_div" placeholder="成本" value="' + data[j].total_cost + '" style="width:90%;margin-left:5%;" /></td>' +
                                    '<td><input readonly type="number" date-aid="' + data[j].id + '" date-rq="' + dayTitle + '"  class="layui-input input_div" placeholder="利率" value="{$trip.ticket_rate}" style="color:red;text-align: center;" /></td>' +
                                    '<td><input readonly type="number" date-aid="' + data[j].id + '" date-rq="' + dayTitle + '"  class="layui-input input_div" placeholder="设置时汇率" value="' + exchangeNum + '" style="color:red;text-align: center;" /></td>' +
                                    '<td><input readonly type="number" autocomplete="off" name="person_price" date-dayid="' + data[j].id + '" date-rq="' + dayTitle + '" class="layui-input person_price_input input_div" placeholder="售价" value="' + data[j].price + '" style="width:90%;margin-left:5%;" /></td>';
                                tab += '</tr>';
                            }
                            tab +=
                                '</tbody></table>' +
//                                '</table>' +'<a class="layui-btn layui-btn-sm layui-btn-normal modifySingleDayPrice">保存</a>' +
                                '</div>';
                        }
                    }
                }

                tr += '</tbody>' +
                    '</table>' +
                    '</div>' +
                    '<div class="layui-col-md1">&nbsp</div>' +
                    '<div class="layui-col-md5 tabto">' + tab + '</div>' +
                    '</div>';
                return tr;
            }

            //日历点击展示当日规格&价格
            function clickOneday(_that,type){
                $('.ri').removeClass('bj');
                $('.day_price').removeClass('bj');
                _that.addClass('bj');
                var ri;
                var specs;
                if(type=='date'){
                    ri = _that.attr('date-ri');
                    specs = _that.attr('date-specs');
                    _that.next().addClass('bj')
                }else{
                    ri = _that.prev().attr('date-ri');
                    specs = _that.prev().attr('date-specs');
                    _that.prev().addClass('bj')
                }
                $('#yue' + specs + ' #' + ri).siblings().hide();
                $('#yue' + specs + ' #' + ri).show();
                //点击时间弹框 取消自20190319-bywtt
                layer.msg(ri + '号', {
                    time: 700
                });
            }
            $(document).on('click', '.ri', function() {
                if($(this).hasClass('show')){
                    clickOneday($(this),'date')
                }
            });
            $(document).on('click', '.day_price', function() {
                if($(this).prev().hasClass('show')){
                    clickOneday($(this),'price')
                }
            });

            //切换套餐
            element.on('tab(package)', function() {
                var starttime = $('#starttime').val(); //获取开始时间
                var endtime = $('#endtime').val(); //获取结束时间
                var package_id = this.getAttribute('data-id'); //获取套餐id
                if($('#yue' + package_id + ' #yue').is(":empty")) {
                    $.ajax({
                        url: posurl,
                        type: "post",
                        dataType: "json",
                        data: {'package_id': package_id},
                        success: function(data) {
                            yue(starttime, endtime, package_id, data);
                        },
                        error: function(jqXHR) {
                            console.log(jqXHR);
                        }
                    });
                }
            });

            //配置价格
            $(document).on('click', '.setBtn', function(){
                var package_id = $(this).attr("date-pid");
                addBatch(package_id);
                return false;
            });

            //配置套餐
            $(document).on('click', '.setPackage', function(){
                addPackage();
                return false;
            });

            /*********【普通成本】配置弹窗   click打开*************/
            //【普通成本】
            function addBatch() {
                //添加时需要展示快照信息
                $("#specsPriceSnap").show();
                var package_id = $(".addBatch").attr('date-pid');
                $.post(posurl, {
                    'package_id': package_id
                }, function(data) {
                    renderSelectTimeForm();
                    form.render();
                    renderPersonList(data);
                });
                //显示添加时间的按钮 不允许修改
                $(".addMoreTime").show();
                moreTimeList = [];
                $("#moreTimeArr").children().remove();
                //打开一个弹窗 点击保存触发事件
                layer.open({
                    type: 1,
                    area: ['95%', '95%'],
                    btn: ['保存', '取消'],
                    content: $('#setPriceShade'),
                    yes: function(index, layero) {
                        var pro_start_day = $('#starttime').val(); //获取开始时间
                        var pro_end_day = $('#endtime').val(); //获取结束时间
                        var save_start_day = $("input[name=t-starttime]").val();
                        var save_end_day = $("input[name=t-endtime]").val();
                        var pro_start_time = parseInt(new Date(pro_start_day + ' 00:00:00').getTime());
                        var save_start_time = parseInt(new Date(save_start_day + ' 00:00:00').getTime());
                        var pro_end_time = parseInt(new Date(pro_end_day + ' 23:59:59').getTime());
                        var save_end_time = parseInt(new Date(save_end_day + ' 23:59:59').getTime());
                        if(save_start_time < pro_start_time) {
                            layer.msg('时间段开始时间小于产品上架时间');
                            return false;
                        }
                        if(save_end_time > pro_end_time) {
                            layer.msg('时间段结束时间大于产品下架时间');
                            return false;
                        }
                        if(save_end_time < save_start_time) {
                            layer.msg('结束时间不能小于开始时间');
                            return false;
                        }
                        var time_type = $('input[name=time_type]:checked').val();
                        var month_value = $('input[name=month_value]:checked').val();
                        var time_value = [];
                        if(time_type==0 || time_type==3){
                            time_value = '';
                        }else if(time_type==1){
                            time_value = month_value;
                        }else{
                            var week_value = $("input[name=week]:checked");
                            if(week_value.length<1){
                                layer.msg("请选择日期类型");
                                return false;
                            }else{
                                $.each(week_value,function(i,v){
                                    time_value.push($(v).val())
                                });
                                time_value = time_value.join(",");
                            }
                        }
                        //获取筛选的数据
                        var selectDays = getDaysByDates(save_start_day,save_end_day,time_type,time_value);
                        if(time_type==3){
                            selectDays = moreTimeList;
                        }
                        if(selectDays.length < 1){
                            layer.msg("您选择的时间段中没有时间被选择");
                            return false;
                        }
                        //保存数据
                        savePackageData(package_id,selectDays,moreTimeList);
                    }
                });
            }

            //【设置套餐】
            function addPackage() {
                var product_id = $("#product_id").val();
                var url = "/admin/ticket/addPackage?id="+product_id;
                //打开一个弹窗 点击保存触发事件
                layer.open({
                    type:2,
                    content:url,
                    area: ['90%', '90%'],
                    end:function(){
                        location.reload();
                    }
                });
            }

            //【批量删除】
            $(document).on('click', '.deleteBatch', function() {
                //删除时不需要展示快照信息
                $("#specsPriceSnap").hide();
                var package_id = $(this).attr('date-pid');
                $.post(posurl, {'package_id': package_id}, function(da) {
                    renderSelectTimeForm();
                    form.render();
                    renderPersonList(da);
                });
                //显示添加时间的按钮 允许修改
                $(".addMoreTime").show();
                moreTimeList = [];
                $("#moreTimeArr").children().remove()
                //打开一个弹窗 点击保存触发事件
                layer.open({
                    type: 1,
                    area: ['1000px', '70%'],
                    btn: ['删除', '取消'],
                    content: $('#setPriceShade'),
                    yes: function(index, layero) {
                        var pro_start_day = $('#starttime').val(); //获取开始时间
                        var pro_end_day = $('#endtime').val(); //获取结束时间
                        var save_start_day = $("input[name=t-starttime]").val();
                        var save_end_day = $("input[name=t-endtime]").val();
                        var pro_start_time = parseInt(new Date(pro_start_day + ' 00:00:00').getTime());
                        var save_start_time = parseInt(new Date(save_start_day + ' 00:00:00').getTime());
                        var pro_end_time = parseInt(new Date(pro_end_day + ' 23:59:59').getTime());
                        var save_end_time = parseInt(new Date(save_end_day + ' 23:59:59').getTime());
                        if(save_start_time < pro_start_time) {
                            layer.msg('时间段开始时间小于产品上架时间');
                            return false;
                        }
                        if(save_end_time > pro_end_time) {
                            layer.msg('时间段结束时间大于产品下架时间');
                            return false;
                        }
                        if(save_end_time < save_start_time) {
                            layer.msg('结束时间不能小于开始时间');
                            return false;
                        }
                        var time_type = $('input[name=time_type]:checked').val();
                        var month_value = $('input[name=month_value]:checked').val();
                        var time_value = [];
                        if(time_type==0 || time_type==3){
                            time_value = '';
                        }else if(time_type==1){
                            time_value = month_value;
                        }else{
                            var week_value = $("input[name=week]:checked");
                            if(week_value.length<1){
                                layer.msg("请选择日期类型");
                                return false;
                            }else{
                                $.each(week_value,function(i,v){
                                    time_value.push($(v).val())
                                });
                                time_value = time_value.join(",");
                            }
                        }
                        //获取筛选的数据
                        var selectDays = getDaysByDates(save_start_day,save_end_day,time_type,time_value);
                        if(time_type==3){
                            selectDays = moreTimeList;
                        }
                        if(selectDays.length < 1){
                            layer.msg("您选择的时间段中没有时间被选择");
                            return false;
                        }
                        // 保存数据
                        packageDeleteData(package_id,selectDays,moreTimeList);
                    }
                });
            });
            //修改单日的套餐价格
            $(document).on('click','.modifySingleDayPrice',function(){
                var priceTable = $(this).prev().find('.person_price_input');
                var postdata = [];
                var flag = true;
                $.each(priceTable,function(i,v){
                    var id = $(v).attr('date-dayid');
                    var price = $(v).val();
                    if(price=="" || price<=0 || price==undefined){
                        flag = false;
                        return false;
                    }else{
                        postdata.push({id:id,price:price});
                    }
                });
                if(!flag){
                    layer.msg("请填写所有的价格！");return false;
                }else{
                    postdata = JSON.stringify(postdata);
                    var product_id = $('#product_id').val(); //获取产品id
                    $.post("/admin/product/setSingleDayPrice",{product_id:product_id,data:postdata},function(data){
                        layer.msg(data.msg);
                        if(data.code=='200'){
                            setTimeout(function(){
                                window.location.reload();
                            },1000)
                        }
                    },'json')
                }
            });

            //【普通成本】弹窗中时间段选择渲染
            function renderSelectTimeForm(){
                $('#selectTimeForm').children().remove();
                var str = '<label class="layui-form-label">&nbsp;</label>\n' +
                    '                        <div class="layui-input-block layui-col-xs6" style="margin: 0;">\n' +
                    '                            <input type="radio" lay-filter="time_type" title="全部" checked name="time_type" value="0" />\n' +
                    '                            <input type="radio" lay-filter="time_type" title="按单双日" name="time_type" value="1" />\n' +
                    '                            <input type="radio" lay-filter="time_type" title="按星期" name="time_type" value="2" />\n' +
                    '                        </div>\n' +
                    '                        <div class="layui-input-block layui-col-xs8" id="single" style="margin: 0;display: none;">\n' +
                    '                            <input type="radio" lay-filter="month_value" title="每月单日" name="month_value" value="8" />\n' +
                    '                            <input type="radio" lay-filter="month_value" title="每月双日" name="month_value" value="9" />\n' +
                    '                        </div>\n' +
                    '                        <div class="layui-input-block layui-col-xs8" id="week" style="margin: 0;display: none;">\n' +
                    '                            <input type="checkbox" lay-skin="primary" lay-filter="xq" title="每周一" class="time_week" name="week" value="1" />\n' +
                    '                            <input type="checkbox" lay-skin="primary" lay-filter="xq" title="每周二" class="time_week" name="week" value="2" />\n' +
                    '                            <input type="checkbox" lay-skin="primary" lay-filter="xq" title="每周三" class="time_week" name="week" value="3" />\n' +
                    '                            <input type="checkbox" lay-skin="primary" lay-filter="xq" title="每周四" class="time_week" name="week" value="4" />\n' +
                    '                            <input type="checkbox" lay-skin="primary" lay-filter="xq" title="每周五" class="time_week" name="week" value="5" />\n' +
                    '                            <input type="checkbox" lay-skin="primary" lay-filter="xq" title="每周六" class="time_week" name="week" value="6" />\n' +
                    '                            <input type="checkbox" lay-skin="primary" lay-filter="xq" title="每周日" class="time_week" name="week" value="0" />\n' +
                    '                        </div>\n';
                $('#selectTimeForm').append(str);
            }
            //【普通成本】弹窗中规格table渲染
            function renderPersonList(data){
                //渲染规格
                $('.batch_person').html('');
                var sr = '';
                $.each(data, function(i, v) {
                    sr += '<tr date-id="' + v.id + '">' +
                        '<td><input readonly type="text" name="person_name" id="person_name" class="layui-input" placeholder="' + v.name + '" value="' + v.name + '"/>' +
                        '<input type="hidden" name="person_id" id="person_id" class="layui-input" value="' + v.id + '"/></td>' +
                        '<td>' +
                        '<div style="width:13%;float: left;line-height: 40px;color:red;">{$currency_flag}</div>' +
                        '<div style="width:80%;float: left;margin-top:5px;"><input type="text" name="person_cost" class="layui-input person_cost" placeholder="请填写" autocomplete="off" value="" style="border:1px solid black;" /></div>' +
                        '</td>' +
                        '<td><input readonly type="text" class="layui-input" autocomplete="off" value="x {$trip.ticket_rate}"/></td>' +
                        '<td><input readonly type="text" class="layui-input" autocomplete="off" value="x {$exchangeNum}"/></td>' +
                        '<td>' +
                        '<div style="width:13%;float: left;line-height: 40px;color:red;">￥</div>' +
                        '<div style="width:80%;float: left;margin-top:5px;"><input readonly type="text" name="person_price" class="layui-input person_price" autocomplete="off" value="0" /></div>' +
                        '</td>' +
                        '<td><input readonly type="text" name="person_num" id="person_num" class="layui-input" placeholder="库存" value="' + v.num + '" /></td>' +
                        '<td><input readonly type="text" name="minorder_num" id="minorder_num" class="layui-input" placeholder="最低下单数" value="' + v.minorder_num +'" /></td>' +
                        '<td><input readonly type="text" name="inc_order_num" id="inc_order_num" class="layui-input" placeholder="最小增长数" value="' + v.inc_order_num +'" /></td></tr>';
                });

                $('.batch_person').html(sr);
                form.render('select');
            }

            //提交数据时组装日期价格数据
            function getDaysByDates(starttime,endtime,time_type,time_value){
                var dateArry = new Array();
                var s1 = starttime.split("-");
                var s2 = endtime.split("-");
                var monthCount = 0;
                if(parseInt(s1[0]) < parseInt(s2[0])) {
                    monthCount = (parseInt(s2[0]) - parseInt(s1[0])) * 12 + parseInt(s2[1]) - parseInt(s1[1]) + 1;
                } else {
                    monthCount = parseInt(s2[1]) - parseInt(s1[1]) + 1;
                }
                var stime= new Date(starttime+' 00:00:00').getTime()-1000;
                var etime= new Date(endtime+' 23:59:59').getTime();
                if(monthCount > 0) {
                    var startM = parseInt(s1[1]);
                    var startY = parseInt(s1[0]);
                    for(var i = 0; i < monthCount; i++) {
                        var da = new Date(startY, startM, 0);
                        //获取每月有多少天
                        var day = da.getDate(); //获取当前月有多少天
                        for(j = 1; j <= day; j++) {
                            var the_day = startY + "-" + (startM > 9 ? startM : "0" + startM) + "-" + (j > 9 ? j : "0" + j);
                            var curtime = new Date(startY + '-' + startM + '-' + j + ' 00:00:00');
                            var curtime = curtime.getTime();
                            if(curtime < stime || curtime > etime){
                                continue;
                            }
                            if (time_type == 0) {
                                dateArry.push(the_day);
                            } else if(time_type ==1) {
                                //单日
                                if (j % 2 == 1 && time_value == '8') {
                                    dateArry.push(the_day);
                                } else if (j % 2 == 0 && time_value == '9') {
                                    //双日
                                    dateArry.push(the_day);
                                }
                            }else if(time_type ==2){
                                //周
                                var value = time_value.split(",");
                                var w = new Date(startY + '-' + startM + '-' + j)
                                var the_week = w.getDay();
                                var index= value.indexOf(String(the_week));
                                if ( index > -1) {
                                    dateArry.push(the_day);
                                }

                            }
                        }
                        if(startM<12){
                            startM += 1;
                        }else{
                            startM = 1;
                            startY += 1;
                        }
                    }
                }
                return dateArry;
            }
            //【普通成本】提交数据
            function savePackageData(package_id,date,more_time){
                //记录数据
                var postData = {};
                //组装数组
                var specs = [];
                var personlist = $(".batch_person tr");
                var currency = $("#currency").val();
                var exchangeNum = $("#exchangeNum").val();
                $.each(personlist,function(i,v){
                    var spec = {};
                    spec.id = $(v).find("input[name=person_id]").val();
                    spec.cost = $(v).find("input[name=person_cost]").val();
                    spec.currency = currency;
                    spec.exchangeNum = exchangeNum;
                    spec.price = $(v).find("input[name=person_price]").val();
                    specs.push(spec);
                });
                postData.specs = specs;
                postData.date = date;
                //组装时间集合
                postData.package_id = package_id;
                postData.more_time = more_time;
                var param = JSON.stringify(postData);
                var shadowindex = layer.load(1);
                $.post("/admin/ticket/ajaxsetgoodsprice",{param},function(data){
                    layer.close(shadowindex);
                    layer.msg(data.msg);
                    if(data.code==200){
                        setTimeout(function(){
                            window.location.reload();
                        },1500);
                    }
                },'json');
                return true;
            }
            //【批量删除】提交数据
            function packageDeleteData(package_id,date,more_time){
                var postData = {};
                postData.date = date;
                //组装时间集合
                postData.package_id = package_id;
                postData.more_time = more_time;
                var param = JSON.stringify(postData);
                var shadowindex = layer.load(1);
                $.post("/admin/product/delsetgoodsprice",{param},function(data){
                    layer.close(shadowindex);
                    layer.msg(data.msg);
                    if(data.code==200){
                        setTimeout(function(){
                            window.location.reload();
                        },1500)
                    }
                },'json');
                return true;
            }

            //点击日期类型 切换tab
            function changeTimeType(value){
                if(value==1){
                    $("#single").show();
                    $("#week").hide();
                    $("#moreTimeForm").show();
                }else if(value==2){
                    $("#single").hide();
                    $("#week").show();
                    $("#moreTimeForm").show();
                }else if(value==3){
                    $("#single").hide();
                    $("#week").hide();
                    $("#moreTimeForm").show();
                }else{
                    $("#single").hide();
                    $("#week").hide();
                    $("#moreTimeForm").hide();
                }
            }
            //弹框日期选择
            form.on('radio(time_type)', function(data) {
                var value = data.value;
                changeTimeType(value);
            });
            //弹层单选按钮
            form.on('radio(radio)', function(data) {
                if(data.value == 3) {
                    $('#chx').css('display', 'block');
                } else {
                    $('#chx').css('display', 'none');
                }
            });

            //【普通成本】弹窗中时间段
            //添加具体的天数
            $(".addMoreTime").click(function(){
                var currentTime = $("input[name=moreTime]").val();
                var t_starttime=$("input[name=t-starttime]").val();
                var t_endtime=$("input[name=t-endtime]").val();
                if(t_starttime=='' || t_endtime==''){
                    layer.msg("请选择开始和结束时间");return false;
                }else if(currentTime=="" || currentTime==undefined){
                    layer.msg("请选择时间");
                }else if($.inArray(currentTime,moreTimeList)>-1){
                    layer.msg("请勿重复添加时间");
                }else if(currentTime<t_starttime || currentTime > t_endtime){
                    layer.msg("请在开始和结束时间之间选择");
                }else{
                    moreTimeList.push(currentTime);
                    var str = '<a class="layui-btn layui-btn-sm layui-bg-cyan delMoreTime" data-id="'+currentTime+'" style="margin:8px;">'+currentTime+' <i class="layui-icon">&#x1006;</i></a>\n';
                    $("#moreTimeArr").append(str);
                }
            });
            //删除具体的天数
            $(document).on('click','.delMoreTime',function(){
                var currentTime = $(this).attr('data-id');
                moreTimeList.splice($.inArray(currentTime,moreTimeList),1);
                $(this).remove();
            });
        });


        //实时计算
        //输入成本&售价变动
        function countCost(){
            var ticket_rate = $("#ticket_rate").attr("value");
            var exchangeNum = $("#exchangeNum").attr("value");
            ticket_rate = Number(ticket_rate);
            exchangeNum = Number(exchangeNum);
            $(".person_cost").each(function(){
                var cost = $(this).val();
                if(cost==undefined || cost<=0){
                    price = 0;
                }else{
                    cost = Number(cost);
                    var price = cost*exchangeNum*ticket_rate;
                    price = Math.round(price);
                    if(price<0 || price==undefined){
                        price = 0;
                    }
                }
                $(this).parent().parent().parent().find(".person_price").attr("value",price);
            });
        }
        $(document).on("input propertychange",'.person_cost',function(){
            countCost();
        });

    </script>
    <script>
//        var sale_details = UE.getEditor('sale_details', { initialFrameWidth: null , autoHeightEnabled: false});
    </script>
</body>
</html>